package com.promote.algorithm;

/**
 * @ClassName Reverse
 * Description 整数反转
 * @Author LiZiHao
 * Date 2022/3/10 16:04
 * @Version 1.0
 **/
public class Reverse {

    public int reverse(int x) {
        long res = 0;

        while (x != 0){
            res = res * 10 + x % 10;

            x = x/10;
        }

        return (int) res == res ? (int) res : 0;
    }
}
